<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;

/* @var $this yii\web\View */
/* @var $model backend\models\LibraryBook */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="create-form library-book-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'inventory_number')->textInput(['maxlength' => true]) ?>
    <div class="row">
        <?= $form->field($model, 'bbk_id', ['options' => ['class' => 'col-sm-6']])->widget(Select2::classname(), [
                    'data' => \backend\models\LibraryBbk::bbkList(),
                    'options' => ['placeholder' => 'Выберете ББК...'],
                ]); 
        ?>
        <?= $form->field($model, 'udk_id', ['options' => ['class' => 'col-sm-6']])->widget(Select2::classname(), [
                'data' => \backend\models\LibraryUdk::udkList(),
                'options' => ['placeholder' => 'Выберете УДК...'],
            ]); 
        ?>
    </div>
    <br>

    <?= $form->field($model, 'author')->textInput(['maxlength' => true]) ?>
    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
    <?= $form->field($model, 'publisher')->textInput(['maxlength' => true]) ?>
    <?= $form->field($model, 'year')->textInput() ?>
    <?= $form->field($model, 'annotation')->textarea(['rows' => 6]) ?>
    <?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>

    <br>

    <?= $form->field($model, 'condition_id')->dropdownList(
            \backend\models\LibraryCondition::find()->select(['title', 'id'])->indexBy('id')->column(),
            [
                'prompt' => 'Выберете сохранность...'
            ]
        );
    ?>
    <?= $form->field($model, 'condition_clarification')->textInput(['maxlength' => true]) ?>
    
    <br>
    <?= $form->field($model, 'collection_id')->dropdownList(
            \backend\models\LibraryCollection::find()->select(['title', 'id'])->indexBy('id')->column(),
            [
                'prompt' => 'Выберете коллекцию...'
            ]
        );
    ?>
    <?= $form->field($model, 'comment')->textarea(['rows' => 6]) ?>
    
    <br>

    <div class="form-group">
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
